﻿{extend name="common/base" /}

{block name="title"}Banner图列表 - Banner图列表{/block}

{block name="content"}
<div class="Hui-admin-banner">
    <nav class="breadcrumb" style="background-color:#fff;padding: 0 24px">
        首页
        <span class="c-gray en">/</span>
        Banner图管理
        <span class="c-gray en">/</span>
        Banner图列表
    </nav>

    <banner class="Hui-admin-content clearfix">

        <div class="panel mt-20">
            <div class="panel-body">
                <form class="row clearfix">
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="row clearfix mb-10">
                            <span class="col-xs-4 form-item-label">分类：</span>
                            <span class="col-xs-8 form-item-control">
                                <span class="select-box">
                                    <select name="type_id" class="select">
                                        <option value=''>全部</option>
                                        {foreach $types as $k=>$v}
                                        <option {if $v.id == $search.type_id}selected{/if} value="{$v['id']}">{$v.title}</option>
                                        {/foreach}
                                    </select>
                                </span>
                            </span>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="row clearfix mb-10">
                            <span class="col-xs-4 form-item-label">开始日期：</span>
                            <span class="col-xs-8 form-item-control">
                                <input type="text" id="search-datetime-start" name="start" value="{$search.start}" class="input-text datetimepicker-input">
                            </span>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="row clearfix mb-10">
                            <span class="col-xs-4 form-item-label">结束日期：</span>
                            <span class="col-xs-8 form-item-control">
                                <input type="text" id="search-datetime-end" name="end" value="{$search.end}" class="input-text datetimepicker-input">
                            </span>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="row clearfix mb-10">
                            <span class="col-xs-4 form-item-label">标题名称：</span>
                            <span class="col-xs-8 form-item-control">
                                <input type="text" name="title" value="{$search.title}" id="search-input" placeholder="名称" class="input-text" />
                            </span>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-4">
                        <div class="row clearfix">
                            <span class="col-xs-4 form-item-control">
                                <button name="" id="search-submit" class="btn btn-success radius" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜banner</button>
                            </span>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-body">
                <div class="clearfix">
                    <span class="f-l">
                        <a href="javascript:;" onclick="banner_del_all()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
                        <a href="javascript:;" onclick="banner_add('添加Banner图')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加Banner图</a>
                    </span>
                    <span class="f-r">共有数据：<strong>{$count}</strong> 条</span>
                </div>
                <div class="mt-20 clearfix">
                    <table class="table table-border table-bordered table-bg table-hover table-sort">
                        <thead>
                            <tr>
                                <th scope="col" colspan="8">Banner图列表</th>
                            </tr>
                            <tr class="text-c">
                                <th width="25"><input type="checkbox" name="all" value=""></th>
                                <th width="40">ID</th>
                                <th width="150">标题</th>
                                <th width="150">副标题</th>
                                <th width="150">图片</th>
                                <th width="100">链接</th>
                                <th width="100">是否已启用</th>

                                <th width="100">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach name="list" key="k" item="v"}
                            <tr class="text-c">
                                <td><input name="list_box" type="checkbox" value="{$v.id}" ></td>
                                <td>{$k+1}</td>
                                <td>{$v.title}</td>
                                <td>{$v.title_en}</td>
                                <td><img src="{$v.image}" height="100"></td>
                                <td >
                                    {if $v.link_type == 1}
                                    内链：{$v.link}
                                    {elseif $v.link_type == 2 /}
                                    外链：{$v.link}
                                    {else /}
                                    无
                                    {/if}
                                </td>
                                <td class="td-status">
                                    {if $v.status == 1}
                                    <span class="label label-success radius">已启用</span>
                                    {else /}
                                    <span class="label radius">已停用</span>
                                    {/if}
                                </td>
                                <td class="td-manage">
                                    {if $v.status == 1}
                                    <a style="text-decoration:none" onClick="set_stop(this,{$v.id})" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a> 
                                    {else /}
                                    <a style="text-decoration:none" onClick="set_start(this,{$v.id})" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe615;</i></a> 
                                    {/if}
                                    <a title="编辑" href="javascript:;" onclick="banner_edit('Banner图编辑',{$v.id},'900','600')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
                                    <a title="删除" href="javascript:;" onclick="banner_del(this,{$v.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                                </td>
                            </tr>
                            {/foreach}
                            
                        </tbody>
                    </table>
                    
                    {$page}
                </div>
            </div>
        </div>
    </banner>
</div>
<input name="set_status" type="hidden" value="{:url('banner/set_status')}">
<input name="del" type="hidden" value="{:url('banner/del')}">
<input name="edit" type="hidden" value="{:url('banner/edit')}">
<input name="add" type="hidden" value="{:url('banner/add')}">
<input name="delAll" type="hidden" value="{:url('banner/delAll')}">
{/block}


{block name="js"}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/datatables/1.10.15/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__LIB__/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="__JS__/main.js"></script>
<script type="text/javascript">
    $(function(){
        runDatetimePicker();
    });
    
    $("select[name='link_type']").bind('change',function(){
        var val = $(this).val();
        if(val == 3){
            $("input[name='link']").show();
        }else{
            $("input[name='link']").hide();
        }
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
{/block}

